

// import { Button } from 'element-ui'
export const addimg = (editor) => {
    const {
        Components
    } = editor;
    Components.addType('addshare', {
        model: {
            defaults: {
                tagName: 'div',
                name: 'addshare',
                attributes: {
                    class: 'share'
                },
                droppable: true,
                components: [{
                    tagName: 'img',
                    attributes: {
                        id: 'clicktype',
                        src: 'https://mybuketh.oss-cn-beijing.aliyuncs.com/share.png'
                    },
                }],

                traits: [],
                script() {
                    var click = document.getElementById('clicktype');
                    click.onclick = function () {
                        if (click.src.indexOf('share.png') != -1) {
                            click.src = 'https://mybuketh.oss-cn-beijing.aliyuncs.com/shareBule.png';
                        } else {
                            click.src = 'https://mybuketh.oss-cn-beijing.aliyuncs.com/share.png';
                        }
                    }
                },
                styles: `
                 .loveicon{
                    width: 40px;
                    height: 40px;
                }
                   
                `
            },
            init() {},
        }
    });

    // 注册组件
    editor.BlockManager.add('addshare', {
        label: '添加分享',
        category: '其他类',
        media: '<svg t="1724153312692" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="7424" width="32" height="32"><path d="M288 373.333333c-82.432 0-149.333333 66.922667-149.333333 149.333334a149.333333 149.333333 0 0 0 149.333333 149.333333c82.496 0 149.333333-66.816 149.333333-149.333333 0-82.410667-66.88-149.333333-149.333333-149.333334z m0 64c47.104 0 85.333333 38.250667 85.333333 85.333334 0 47.146667-38.186667 85.333333-85.333333 85.333333a85.333333 85.333333 0 1 1 0-170.666667zM757.333333 672a128.021333 128.021333 0 1 0 128 128c0-70.656-57.344-128-128-128z m0 64a64.021333 64.021333 0 1 1-64 64c0-35.328 28.672-64 64-64zM757.333333 117.333333a128.021333 128.021333 0 1 0 128 128c0-70.656-57.344-128-128-128z m0 64a64.021333 64.021333 0 1 1-64 64c0-35.328 28.672-64 64-64z"  p-id="7425"></path><path d="M356.565333 580.864a32 32 0 0 1 43.904-10.965333l266.666667 160a32 32 0 0 1-32.938667 54.869333l-266.666666-160a32 32 0 0 1-10.965334-43.904zM643.050667 264.789333a32 32 0 0 1 36.565333 52.522667l-256 178.282667a32 32 0 0 1-36.565333-52.522667l256-178.282667z"  p-id=fill"7426"></path></svg>',
        content: {
            type: 'addshare'
        },
    });
};